package com.accp.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.accp.pojo.Room;
import com.accp.service.RoomService;
import com.accp.service.impl.RoomServiceImpl;


@Controller
public class RoomController {
	
	@Autowired
	RoomService roomService =new RoomServiceImpl();
	
	
	@RequestMapping("/getAllRoom")
	public String getAllRomm(Model model){
		
		List<Room> room=roomService.getAllRoom();
		
		
		
		model.addAttribute("room", room);
		
		return "Room";
	}
	
	
	
	
	
	@RequestMapping("/getByState")
	public String getRoomByState(Integer roomState,Model model){
		
		
		System.out.println("id"+roomState);
		
		List<Room> room=roomService.getByState(roomState);
		
		
		
		model.addAttribute("room2", room);
		
		return "Room";
	}
	
	
	
	
}
